console.log(false ^ false); //0
console.log(false ^ true); //1
console.log(true ^ false); //1
console.log(true ^ true); //0
console.log(false); //0
console.log(true); //1


console.log(false | false); //0
console.log(false | true); //1
console.log(true | false); //1
console.log(true | true); //0


function clearAndPushAll(arr, items) {
    arr.splice(0, arr.length);
    arr.push(...items);
}

let arr1 = [];
clearAndPushAll(arr1, ['aaa', 'bbb'])
clearAndPushAll(arr1, 'aaa')


let aa = [
    {
        "start": 0,
        "end": 13,
        "type": "normal",
        "text": "By the time I "
    }, {
        "start": 14,
        "end": 29,
        "type": "topMost",
        "text": "got around to it"
    }, {
        "start": 30,
        "end": 35,
        "type": "normal",
        "text": ", the "
    }, {
        "start": 36,
        "end": 58,
        "type": "topMost",
        "text": "lawn had been colonized",
        "wordsArr": [{
            "startIdx": 50,
            "text": "colonized",
            "wordRankLevel": "topWord"
        }],
        "subSplits": [{
            "startIdx": 0,
            "text": "lawn had been "
        }, {
            "startIdx": 50,
            "text": "colonized",
            "wordRankLevel": "topWord"
        }]
    }, {"start": 59, "end": 59, "type": "normal", "text": " "}, {
        "start": 60,
        "end": 77,
        "type": "topMost",
        "text": "by a large clan of",
        "wordsArr": [{"startIdx": 71, "text": "clan", "wordRankLevel": "topWord"}],
        "subSplits": [
            {
                "startIdx": 0,
                "text": "by a large "
            }, {
                "startIdx": 71,
                "text": "clan",
                "wordRankLevel": "topWord"
            }, {"startIdx": 75, "text": " of"}]
    }, {"start": 78, "end": 78, "type": "normal", "text": " "}, {
        "start": 79,
        "end": 101,
        "type": "topMost",
        "text": "earth-burrowing hornets",
        "wordsArr": [{"startIdx": 95, "text": "hornets", "wordRankLevel": "topWord"}],
        "subSplits": [
            {
                "startIdx": 0,
                "text": "earth-burrowing "
            }, {
                "startIdx": 95,
                "text": "hornets",
                "wordRankLevel": "topWord"
            }]
    }, {
        "start": 102,
        "end": 102,
        "type": "normal",
        "text": "."
    }];

let aa1 = [
    {
        "start": 0,
        "end": 21,
        "type": "topMost",
        "text": "Burrowing their way to"
    }, {
        "start": 22,
        "end": 39,
        "type": "normal",
        "text": " the crown I wear.",
        "wordsArr": [{"startIdx": 27, "text": "crown", "wordRankLevel": "topWord"}],
        "subSplits": [{
            "startIdx": 0,
            "text": " the "
        }, {
            "startIdx": 27,
            "text": "crown",
            "wordRankLevel": "topWord"
        }, {"startIdx": 32, "text": " I wear."}]
    }]


let aa2 = [
    {
        "start": 0,
        "end": 66,
        "type": "normal",
        "text": "To form (a tunnel, for example) by drilling, digging, or burrowing.",
        "wordsArr": [
            {
                "startIdx": 35,
                "text": "drilling",
                "wordRankLevel": "topWord"
            }, {
                "startIdx": 45,
                "text": "digging",
                "wordRankLevel": "topWord"
            }, {
                "startIdx": 57,
                "text": "burrowing",
                "wordRankLevel": "topWord"
            }
        ],
        "subSplits": [
            {"startIdx": 0, "text": "To form (a tunnel, for example) by "},
            {
                "startIdx": 35,
                "text": "drilling",
                "wordRankLevel": "topWord"
            },
            {"startIdx": 43, "text": ", "},
            {"startIdx": 45, "text": "digging", "wordRankLevel": "topWord"},
            {
                "startIdx": 52,
                "text": ", or "
            }, {"startIdx": 57, "text": "burrowing", "wordRankLevel": "topWord"},
            {"startIdx": 66, "text": "."}]
    }]


let aa3 = [
    {
        "start": 0,
        "end": 6,
        "type": "normal",
        "text": "It's a "
    }, {
        "start": 7,
        "end": 20,
        "type": "topMost",
        "text": "case of timing"
    }, {
        "start": 21,
        "end": 22,
        "type": "normal",
        "text": ", "
    }, {
        "start": 23,
        "end": 41,
        "type": "topMost",
        "text": "dodging the minions",
        "wordsArr": [{"startIdx": 23, "text": "dodging", "wordRankLevel": "topWord"}],
        "subSplits": [
            {
                "startIdx": 23,
                "text": "dodging",
                "wordRankLevel": "topWord"
            }, {
                "startIdx": 30,
                "text": " the minions"
            }]
    }, {
        "start": 42,
        "end": 46,
        "type": "normal",
        "text": " and "
    },
    {
        "start": 47,
        "end": 68,
        "type": "topMost",
        "text": "timing my burrowing to",
        "wordsArr": [{"startIdx": 47, "text": "timing", "wordRankLevel": "topWord"}],
        "subSplits": [
            {
                "startIdx": 47,
                "text": "timing",
                "wordRankLevel": "topWord"
            },
            {
                "startIdx": 53,
                "text": " my burrowing to"
            }]
    }, {
        "start": 69,
        "end": 80,
        "type": "normal",
        "text": " crack that ",
        "wordsArr": [{"startIdx": 70, "text": "crack", "wordRankLevel": "topWord"}],
        "subSplits": [
            {
                "startIdx": 0,
                "text": " "
            },
            {
                "startIdx": 70,
                "text": "crack",
                "wordRankLevel": "topWord"
            }, {"startIdx": 75, "text": " that "}]
    }, {
        "start": 81,
        "end": 93,
        "type": "topMost",
        "text": "fragile shell"
    },
    {
        "start": 94,
        "end": 102,
        "type": "normal",
        "text": " without "
    }, {
        "start": 103,
        "end": 127,
        "type": "topMost",
        "text": "pinging off the shielding",
        "wordsArr": [
            {
                "startIdx": 103,
                "text": "pinging",
                "wordRankLevel": "topWord"
            }, {
                "startIdx": 119,
                "text": "shielding",
                "wordRankLevel": "topWord"
            }],
        "subSplits": [
            {
                "startIdx": 103,
                "text": "pinging",
                "wordRankLevel": "topWord"
            },
            {
                "startIdx": 110,
                "text": " off the "
            }, {
                "startIdx": 119,
                "text": "shielding",
                "wordRankLevel": "topWord"
            }]
    }, {"start": 128, "end": 128, "type": "normal", "text": "."}]


let aa4 = [{
    "start": 0,
    "end": 14,
    "type": "normal",
    "text": "Such burrowing ",
    "wordsArr": [{
        "startIdx": 5,
        "text": "burrowing",
        "wordRankLevel": "topWord",
        "idx": 3,
        "preEnd": 25,
        "hasAdjoinWords": false
    }],
    "subSplits": [{"startIdx": 0, "text": "Such "}, {
        "startIdx": 5,
        "text": "burrowing",
        "wordRankLevel": "topWord",
        "idx": 3,
        "preEnd": 25,
        "hasAdjoinWords": false
    }, {"startIdx": 14, "text": " "}]
}, {
    "start": 15,
    "end": 65,
    "type": "topMost",
    "text": "discourages barnacles from clinging to their shells",
    "wordsArr": [{
        "startIdx": 15,
        "text": "discourages",
        "wordRankLevel": "topWord",
        "idx": 2,
        "preEnd": 54,
        "hasAdjoinWords": false
    }, {"startIdx": 27, "text": "barnacles", "wordRankLevel": "topWord", "idx": 0, "preEnd": -1}, {
        "startIdx": 42,
        "text": "clinging",
        "wordRankLevel": "topWord",
        "idx": 1,
        "preEnd": 36,
        "hasAdjoinWords": false
    }],
    "subSplits": [{
        "startIdx": 15,
        "text": "discourages",
        "wordRankLevel": "topWord",
        "idx": 2,
        "preEnd": 54,
        "hasAdjoinWords": false
    }, {"startIdx": 26, "text": " "}, {
        "startIdx": 27,
        "text": "barnacles",
        "wordRankLevel": "topWord",
        "idx": 0,
        "preEnd": -1
    }, {"startIdx": 36, "text": " from "}, {
        "startIdx": 42,
        "text": "clinging",
        "wordRankLevel": "topWord",
        "idx": 1,
        "preEnd": 36,
        "hasAdjoinWords": false
    }, {"startIdx": 50, "text": " to their shells"}]
}, {"start": 66, "end": 66, "type": "normal", "text": "."}]